/**
 * 
 */
package cn.edu.nju.ws.sview.wyge.relations.adataset.relations.qxliu.relation;

import java.util.HashSet;

/**
 * @author Weiyi Ge (geweiyi@gmail.com) 2012-8-27
 * 
 */
public class ConstantPair {
	private String constant_vi;
	private String constant_vj;

	public ConstantPair(String constant_vi, String constant_vj) {
		this.constant_vi = constant_vi;
		this.constant_vj = constant_vj;
	}

	public String getConstantI() {
		return constant_vi;
	}

	public String getConstantJ() {
		return constant_vj;
	}

	public int hashCode() {
		return (constant_vi + constant_vj).hashCode();
	}

	public String toString() {
		return "(" + constant_vi + ", " + constant_vj + ")";
	}

	public boolean equals(Object other) {
		if (constant_vi.equals(((ConstantPair) other).constant_vi)
				&& constant_vj.equals(((ConstantPair) other).constant_vj)) {
			return true;
		}
		return false;
	}

	public static void main(String[] argus) {
		ConstantPair cp1 = new ConstantPair("http://ass", "http://bbb");
		ConstantPair cp2 = new ConstantPair("http://ass", "http://bbb");
		HashSet<ConstantPair> p = new HashSet<ConstantPair>();
		p.add(cp1);
		p.add(cp2);
		for (ConstantPair c : p) {
			System.out.println(c);
		}
	}
}
